var a = getApp();

Page({
    data: {
        page: 1,
        limit: 20,
        cardId: "",
        hasMore: !0,
        record: []
    },
    onLoad: function(t) {
        var e = this;
        if (e.data.hasMore) {
            e.setData({
                nickName: a.globalData.nickName,
                avatarUrl: a.globalData.avatarUrl,
                userId: wx.getStorageSync("userId"),
                cardId: t.carid
            });
            var r = a.globalData.urlRechargrRecord;
            e.getinitData(r);
        }
    },
    getinitData: function(a) {
        var t = this;
        wx.request({
            url: a,
            data: {
                id: t.data.cardId,
                page: t.data.page,
                limit: t.data.limit
            },
            method: "POST",
            header: {
                "content-type": "application/x-www-form-urlencoded"
            },
            success: function(a) {
                var e = JSON.parse(a.data);
                if (console.log(e), e.code) wx.showToast({
                    title: e.msg,
                    icon: "none",
                    duration: 2e3
                }); else {
                    var r = t.data.page, o = t.data.record;
                    e.length < t.data.limit ? t.setData({
                        record: o.concat(e),
                        hasMore: !1,
                        page: r + 1
                    }) : t.setData({
                        record: o.concat(e),
                        hasMore: !0,
                        page: r + 1
                    });
                }
            }
        });
    },
    onReachBottom: function() {
        var t = this, e = a.globalData.urlRechargrRecord;
        t.getinitData(e);
    },
    onShareAppMessage: function() {}
});